$(document).ready(function() {
	(function($) { 
		'use strict';
		$(function() {
			//---- your code begin ----//	 
				var form = new Vue({
					el : '#app',
					data : {
						username:'',
						fullName:'', 
						password:'',
						repassword:'',
						email:''
					},
					ready: function () {
					},
					methods : {
						submit : function() {
							//校验不通过
							if(!this.myValidate()||
							   !keter.validate($('#regist_form')).isFormValid()){
								return;
							}
							$.ajax({
								url: keter.path+'/regist/regist', 
					            method: 'POST',
					    		data: {
					    			username:username.value,
					    			name:fullName.value,
					    			password:password.value,
					    			email:email.value,
					    		}, 
					            success: function (data) {
					            	if(data.success){
										alert(data.message);
					            	}
					            	else{
						                keter.showError(data.message);
					            	}
					            },
					            error: function (error) {
					                keter.showError(error);
					            }
					        });
						},
						//自定义校验
						myValidate:function(){
							if(password.value!=repassword.value){
								keter.vldtip($('#repassword'),'两次输入的密码不符！');
								return false;
							}
							keter.hideVldtip();
							return true;
						}
					}
				})
		   //---- your code end ----//
		});
	})(jQuery);	
});